<div class="box"> 
	<div class="title">
		<h5><?php echo lang('text_heading_title_tp_list') ?></h5>
	</div>
	
	<?php if($tower_provider): ?>
		  <table class="table table-condensed table-striped table-hover table-bordered pull-left" id="records">
			
			<thead>
				<tr>
					<th style="width:5%">ID</th>
					<th style="width:10%">Vendor ID</th>
					<th style="width:10%">Lat</th>
					<th style="width:10%">Long</th>
					<th style="width:17%">Pemilik Tower</th>
					<th style="width:10%">Deskripsi</th>
					<th style="width:8%">Site ID</th>
					<th style="width:8%">Kandidat</th>
					<th style="width:8%">Disewa</th>
					<th style="width:8%">TP/NOM</th>
					<th style="width:8%">Active</th>
					<th style="width:8%">Action</th>
				</tr>
			</thead>
			<tbody>

	<?php foreach ($tower_provider as $row) {
		$link = '&nbsp;';
		//if($wil['created_by'] <> 'ois') {
			//$link="<a href='". base_url('users/edit_user/'. get_instance()->core->encode($wil['wilayah_id'])) ."'>EDIT</a>";
		//}
	?>
			  <tr class="gradeX ">
				<td><?php echo $row['tower_provider_id'] ?></td>
				<td><?php echo $row['vendor_id'] ?></td>
				<td><?php echo $row['lat'] ?></td>
				<td><?php echo $row['lng'] ?></td>
				<td><?php echo $row['nama_pemilik_tower'] ?></td>
				<td><?php echo $row['deskripsi'] ?></td>
				<td><?php echo $row['site_id'] ?></td>
				<td><?php echo $row['kandidat'] ?></td>
				<td><?php echo $row['disewa'] ?></td>
				<td><?php echo $row['tp'] ?></td>
				<td><?php echo $row['active'] ?></td>
				<td align="center"><?php echo $link ?></td>
			</tr>
			<?php } ?>

			</tbody>
		  </table>
	<?php else : ?>
		<tr class="gradeX "><td colspan="12">There are no records created yet.</td></tr>
	<?php endif; ?>
	
</div>

<script type="text/template" id="tplTowerProvider">
	<tr id="${tower_provider_id}">
		<td width="30px">${nomor}</td>
		<td>${vendor_id}</td>
		<td>${lat}</td>
		<td>${lng}</td>
		<td>${nama_pemilik_tower}</td>
		<td>${deskripsi}</td>
		<td>${site_id}</td>
		<td>${kandidat}</td>
		<td>${disewa}</td>
		<td>${tp}</td>
		<td>${active}</td>
		<td width="110px"><a class="updateBtn" href="{updateLink}">Edit</a> | <a class="deleteBtn" href="{deleteLink}">Delete</a></td>
	</tr>
</script>

<script>
$.ajax({
	url: '<?php echo site_url('/site_info/tower_provider') ?>',
	data: { cmd: 'GET_TOWER_PROVIDER' },
	dataType: 'json',
	success: function( response ) {
		var j=1;
		for( var i in response ) {
			//response[ i ].updateLink = updateUrl + '/' + response[ i ].id;
			//response[ i ].deleteLink = delUrl + '/' + response[ i ].id;
			response[ i ].nomor = j;
			j++;
		}
		//clear old rows
		$( '#records > tbody' ).html( '' );
		
		//append new rows
		$('#tplTowerProvider').render( response ).appendTo( "#records > tbody" );
		
		//apply dataTable to #records table and save its object in dataTable variable
		if( typeof dataTable == 'undefined' )
			dataTable = $( '#records' ).dataTable({"bJQueryUI": true});
	}
});
</script>